Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recordlist print #288

Merged
merged 3 commits into from
Nov 1, 2021
Merged

Recordlist print #288

merged 3 commits into from
Nov 1, 2021

Conversation

ateucher
Copy link
Collaborator

It's currently very difficult to access search results past the first 10.

This adds a [ method to for bcdc_recordlist objects, allowing the subsetting of search results without losing the class (and thus print method).

It also increases the maximum number of records printed to 50.

library(bcdata)
#> 
#> Attaching package: 'bcdata'
#> The following object is masked from 'package:stats':
#> 
#>     filter

res <- bcdc_search("B.C.", n = 60)
#> Found 1354 matches. Returning the first 60.
#> To see them all, rerun the search and set the 'n' argument to 1354.

res
#> List of B.C. Data Catalogue Records
#> Number of records: 60
#> Showing the top 50 results. You can assign the output of bcdc_search,
#>  to an object and subset with `[` to see other results in the set.
#> 
#> Titles:
#> 1: Adult Females Charged by Violation (xlsx)
#>  ID: e9eae0f7-bce6-4db5-ae45-a31d8f8cdd70
#>  Name: adult-females-charged-by-violation
#> 2: Adult Males Charged by Violation (xlsx)
#>  ID: de9b937c-8611-4f79-82ac-f65734cc62dd
#>  Name: adult-males-charged-by-violation
#> 3: Male Youth Charged by Violation (xlsx)
#>  ID: 4eb6bff6-2716-4cd2-85f4-5e57872ad859
#>  Name: male-youth-charged-by-violation
#> 4: Total Persons Charged by Violation (xlsx)
#>  ID: 7eea0046-dfb4-4042-bb0f-4cc6db88c0c7
#>  Name: total-persons-charged-by-violation
#> 5: Female Youth Charged by Violation (xlsx)
#>  ID: c46edf8b-c68c-43ca-b1a8-1834b7e48460
#>  Name: female-youth-charged-by-violation
#> 6: BC Crime Types (xlsx)
#>  ID: 92863e19-c061-4b0f-8794-f579081e0c3c
#>  Name: bc-crime-types
#> 7: Number of Offences Cleared by Charge (xlsx)
#>  ID: 0403434f-2a13-473a-aa86-6104768d5379
#>  Name: number-of-offences-cleared-by-charge
#> 8: Number of Offences Cleared Otherwise (xlsx)
#>  ID: 8ffa032a-cf74-4e9c-af32-7e88807cbc41
#>  Name: number-of-offences-cleared-otherwise
#> 9: Clearance Rate by Violation (xlsx)
#>  ID: eea8d63d-7224-4a9b-9ecf-12c8a24577ce
#>  Name: clearance-rate-by-violation
#> 10: Controlled Drugs and Substances Act Drug Offences (xlsx)
#>  ID: da522ca8-df9e-4f17-8a49-2382ad547875
#>  Name: controlled-drugs-and-substances-act-drug-offences
#> 11: Criminal Code Traffic Offences (xlsx)
#>  ID: ee9d4ee0-6a34-4dff-89e0-9add9a969168
#>  Name: criminal-code-traffic-offences
#> 12: Supplemental Layers - Data - Howe Sound Cumulative Effects (other)
#>  ID: 508bf62d-2e2d-4c82-ad58-108d4b09f1d0
#>  Name: supplemental-layers-data-howe-sound-cumulative-effects
#> 13: British Columbia Greenhouse Gas Emissions (csv, txt)
#>  ID: 24c899ee-ef73-44a2-8569-a0d6b094e60c
#>  Name: british-columbia-greenhouse-gas-emissions
#> 14: Policing Jurisdictions and Regions in BC (xlsx)
#>  ID: 35ca3bca-5cb2-49fc-b83a-1e8ef4b1c6e4
#>  Name: policing-jurisdictions-and-regions-in-bc
#> 15: Licensed Security Workers in BC (xlsx)
#>  ID: 3102dd46-a0c7-4519-b854-101a5e213cdc
#>  Name: licensed-security-workers-in-bc
#> 16: Licensed Security Businesses in BC (xlsx)
#>  ID: 86786da1-44a2-4065-ae89-934488da9104
#>  Name: licensed-security-businesses-in-bc
#> 17: Total Number of Offences Cleared (xlsx)
#>  ID: 268431bd-4cc1-43a8-bc55-09fe52cd6540
#>  Name: total-number-of-offences-cleared
#> 18: Summary Data: Long-term Change in Growing Degree Days and Heating
#>  and Cooling Degree Days in BC (csv)
#>  ID: 8f0d304e-161d-42e6-a982-cad13e60bd8f
#>  Name:
#>   summary-data-long-term-change-in-growing-degree-days-and-heating-and-cooling-degree-days-in-bc
#> 19: Water Quality Guidelines of B.C. (csv)
#>  ID: 85d3990a-ec0a-4436-8ebd-150de3ba0747
#>  Name: water-quality-guidelines-of-b-c-
#> 20: Population of Policing Jurisdictions in BC (xlsx)
#>  ID: 149d6d18-84ee-44c4-a770-eae76554e796
#>  Name: population-of-policing-jurisdictions-in-bc
#> 21: Vulnerable Aquifer Recharge and Phosphorus-Affected Areas in B.C.
#>  (zip)
#>  ID: 3d9f32bb-037b-4b5c-aeca-1e77225634a7
#>  Name:
#>   vulnerable-aquifer-recharge-and-phosphorus-affected-areas-in-b-c-
#> 22: Indicator Summary Data: Change in Snow Depth and Snow Water Content
#>  in BC (1950-2014) (csv)
#>  ID: 86526746-40dd-41d2-82c0-fbee3a2e93a2
#>  Name:
#>   indicator-summary-data-change-in-snow-depth-and-snow-water-content-in-bc-1950-2014-
#> 23: Indicator Summary Data: Change in Sea Level in BC (1910-2014) (csv)
#>  ID: 4458bace-7dc2-4c64-9ec8-c5df75117dbd
#>  Name: indicator-summary-data-change-in-sea-level-in-bc-1910-2014-
#> 24: Indicator Summary Data: Long-term Change in Air Temperature and
#>  Precipitation in BC (csv)
#>  ID: 86f93096-8d3d-4b68-ab63-175cc68257e6
#>  Name:
#>   indicator-summary-data-long-term-change-in-air-temperature-and-precipitation-in-bc
#> 25: Indicator Summary Data: Protected Lands and Waters in B.C. (csv)
#>  ID: 6579744d-818c-4b26-839a-28a03edc0d98
#>  Name: indicator-summary-data-protected-lands-and-waters-in-b-c-
#> 26: BC Points of Diversion (other)
#>  ID: 66d74cc4-dc8f-466d-8faf-fe0c6bf5c207
#>  Name: bc-points-of-diversion
#> 27: B.C. Grade 12 Graduate Transitions into B.C. Public Post-Secondary
#>  Education (csv, xlsx)
#>  ID: 27cb36b9-bff8-41c5-be8c-b006a2a55137
#>  Name:
#>   b-c-grade-12-graduate-transitions-into-b-c-public-post-secondary-education
#> 28: Indicator Summary Data: Change in Sea Surface Temperature in BC
#>  (1935-2014) (csv)
#>  ID: ad95a5c1-5e3e-4571-99a8-1090282a9757
#>  Name:
#>   indicator-summary-data-change-in-sea-surface-temperature-in-bc-1935-2014-
#> 29: Water Licensing Watersheds (other, wms, kml)
#>  ID: d43c9dbb-d1cf-49f9-a469-fd424f3b74d7
#>  Name: water-licensing-watersheds
#> 30: North Cowichan Open Data Package (other, fgdb, kml)
#>  ID: eee9e339-97ac-4550-ba96-0dc8fd5117b9
#>  Name: north-cowichan-open-data-package
#> 31: Indicator Summary Data: Change in Size of Glaciers in BC
#>  (1985-2005) (csv)
#>  ID: 89ff86d7-2d04-4c96-b945-ba56688906eb
#>  Name:
#>   indicator-summary-data-change-in-size-of-glaciers-in-bc-1985-2005-
#> 32: Trap Tree Locations in the Omineca Region (shp)
#>  ID: 483bdaa3-d093-4e81-a246-9420fdad54c3
#>  Name: trap-tree-locations-in-the-omineca-region
#> 33: High Precipitation Areas in B.C. (zip)
#>  ID: e31f7488-27fa-4330-ae86-160a0deb8a59
#>  Name: high-precipitation-areas-in-b-c-
#> 34: BC Personal Information Directory (PID) (csv)
#>  ID: 58657662-9135-4a52-994f-031ca01f5398
#>  Name: bc-personal-information-directory-pid
#> 35: Census Marital Status Profiles by Sex and Relationship Type for
#>  CHSA - 2016 Census (other, wms, kml)
#>  ID: aff204d2-8c65-4ac4-b232-d73932eeb120
#>  Name:
#>   census-marital-status-profiles-by-sex-and-relationship-type-for-chsa-2016-census
#> 36: Income Statistics Profiles for Community Health Service Areas -
#>  2016 Census (other, wms, kml)
#>  ID: 0cb88de8-e2b7-47ca-b1c3-0f16baca03e6
#>  Name:
#>   income-statistics-profiles-for-community-health-service-areas-2016-census
#> 37: Student Satisfaction with B.C. Public Post-Secondary Education
#>  (xlsx, csv)
#>  ID: ead35885-d7bb-4d76-8d1b-9f12d1497fc2
#>  Name: student-satisfaction-with-b-c-public-post-secondary-education
#> 38: Beetle Managment Units in the Omineca Region (shp)
#>  ID: c7a2bdad-bee8-4d20-8799-a43ec9b9ccdf
#>  Name: beetle-managment-units-in-the-omineca-region
#> 39: Accumulative AOS in the Omineca Region (shp)
#>  ID: 6b8d4775-c58b-486c-80f9-50f61d63cdcc
#>  Name: accumulative-aos-in-the-omineca-region
#> 40: Census Families Profiles for Community Health Service Areas - 2016
#>  Census (other, wms, kml)
#>  ID: ab766257-8aac-4825-a046-0c2e2a911c40
#>  Name:
#>   census-families-profiles-for-community-health-service-areas-2016-census
#> 41: Local Government Tax Rates and Assessments - Tax Rates 2010 (xls)
#>  ID: 164d4fac-5a57-4364-8da6-55746aa39e9a
#>  Name: local-government-tax-rates-and-assessments-tax-rates-2010
#> 42: Local Government Tax Rates and Assessments - Tax Rates 2008 (xls)
#>  ID: 46812768-c6fb-48f7-9231-bfe12ccbffe6
#>  Name: local-government-tax-rates-and-assessments-tax-rates-2008
#> 43: Local Government Tax Rates and Assessments - Tax Rates 2007 (xls)
#>  ID: 39f86464-cc90-4350-8596-581cd9e1aadf
#>  Name: local-government-tax-rates-and-assessments-tax-rates-2007
#> 44: Canadian Rental Housing Index
#> This record has no resources. bcdata will not be able to access any
#>  data.
#>  ID: 2054495f-db8e-4a17-92e0-a8b8054e8536
#>  Name: canadian-rental-housing-index
#> 45: Voting Strength for Regional Districts 2008 - Kitimat-Stikine (xls)
#>  ID: 04c0dbeb-5278-4a4d-ae78-768cd5312fba
#>  Name: voting-strength-for-regional-districts-2008-kitimat-stikine
#> 46: Indicator Summary Data: Change in Timing and Volume of River Flow
#>  in BC (1912-2012) (csv)
#>  ID: d6f30634-a6a8-45b5-808e-210036f25044
#>  Name:
#>   indicator-summary-data-change-in-timing-and-volume-of-river-flow-in-bc-1912-2012-
#> 47: Points of Well Diversion - Licences (other)
#>  ID: abb38ec9-9b0f-4091-b0eb-166292d2ec33
#>  Name: points-of-well-diversion-licences
#> 48: govTogetherBC Environment-related Engagement Opportunities RSS Feed
#>  (xml)
#>  ID: 0a92d11d-01da-41fc-8ce7-3ff7b533e654
#>  Name:
#>   govtogetherbc-environment-related-engagement-opportunities-rss-feed
#> 49: Voting Strength for Regional Districts 2008 - Fraser-Fort George
#>  (xls)
#>  ID: 32a82f1e-67b5-49fe-a693-9bf944f56999
#>  Name: voting-strength-for-regional-districts-2008-fraser-fort-george
#> 50: govTogetherBC Education and Training-related Engagement
#>  Opportunities RSS Feed (xml)
#>  ID: b9b08091-1ad0-4467-88a0-57c1984fa8e5
#>  Name:
#>   govtogetherbc-education-and-training-related-engagement-opportunities-rss-feed
#> 
#> Access a single record by calling `bcdc_get_record(ID)` with the ID
#>  from the desired record.

res[55:57]
#> List of B.C. Data Catalogue Records
#> Number of records: 3
#> Titles:
#> 1: BC Points of Diversion with Water Licence Information (other, wms,
#>  kml)
#>  ID: ff8c8934-9adc-4ab2-935a-7c495984b4cb
#>  Name: bc-points-of-diversion-with-water-licence-information
#> 2: Income Statistics Profiles over age of 15 for Community Health
#>  Service Areas - 2016 Census (other, wms, kml)
#>  ID: 00b341b8-d0c9-4e1c-b26e-3577c5c9a9d9
#>  Name:
#>   income-statistics-profiles-over-age-of-15-for-community-health-service-areas-2016-census
#> 3: Education Level Profiles for Community Health Service Areas - 2016
#>  Census (other, wms, kml)
#>  ID: 3dc5d7e0-c5eb-45d8-b90e-625ac1797876
#>  Name:
#>   education-level-profiles-for-community-health-service-areas-2016-census
#> 
#> Access a single record by calling `bcdc_get_record(ID)` with the ID
#>  from the desired record.

Created on 2021-10-28 by the reprex package (v2.0.1)

@ateucher ateucher requested a review from boshek October 28, 2021 23:00
Copy link
Collaborator

@boshek boshek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

@ateucher
Copy link
Collaborator Author

Thanks! I'll add a NEWS item then merge

@ateucher ateucher merged commit 8c4970e into master Nov 1, 2021
@ateucher ateucher deleted the recordlist-print branch November 1, 2021 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants